# -*- coding:utf-8 -*-
# 作者：mushroom
# E-Mail : linzhanyu@gmail.com

# 输出命令行
DEF_PROXYPORT = 1984

def ExportPutty( host, port, username, password, proxy_host='127.0.0.1', proxy_port=7070 ):
    command = '%%PUTTY%% -v -C -N -D %s:%d -l %s -pw %s -P %s %s'
    return command % ( proxy_host, proxy_port, username, password, port, host)

def ExportSSH( host, port, username, password, proxy_host='127.0.0.1', proxy_port=7070 ):
    # command = 'ssh -p 22 -CN -D 7070 freeuser2@bullfrog.xinm.tk'
    command = '$ssh -CN -D %d -p %s %s@%s'
    return command %( proxy_port, port, username, host )

def ExportAutoSSH( host, port, username, password, proxy_host='127.0.0.1', proxy_port=DEF_PROXYPORT) :
    command = 'export pass=%s\n' % (password)
    command += 'export proxyport=%d\n' % (proxy_port)
    command += 'export port=%s\n' % (port)
    command += './autossh.sh %s@%s'%(username, host)
    return command

if __name__ == '__main__':
    print ExportPutty( host = '192.168.0.1', port = '80', username = 'freeuser', password = 'xxx' )

